﻿<%@ page language="C#" autoeventwireup="true" inherits="Proccess_ProccessShowButtonUploadProduct, App_Web_gkc5pwow" %>

<script type="text/javascript" src="<%=Utility.modHost %>/Scripts/swfobject.js"></script>
<script type="text/javascript" src="<%=Utility.modHost %>/Flash/jquery.uploadify.v2.1.4.min.js"></script>
<%--<script type="text/javascript" src="<%=Utilitys.modHost %>/Scripts/jquery.simplemodal.js"></script>
 <link href="<%=Utilitys.modHost %>/Styles/uploadify.css" rel="stylesheet" type="text/css" />--%>

<script type="text/javascript">

    $(document).ready(function () {

        $('#FilesUpload').uploadify({
            'uploader': '<%=Utility.modHost %>/Flash/uploadify.swf',
            'script': '<%=Utility.modHost %>/Proccess/ProccessUploadImageContentProduct.aspx?action=upload',
            'cancelImg': 'Images/cancel.png',
            'auto': 'true',
            'multi': 'true',
            'buttonText': 'Upload',
            'queueSizeLimit': 3,
            'simUploadLimit': 2,
            onAllComplete: function () {

                $.post("<%=Utility.modHost %>/Proccess/ProccessUploadImageContentProduct.aspx?action=complete", function (dataImage) {
                    var rand_no = Math.random();
                   
                    var oEditor = CKEDITOR.instances.txtDescription;
                  
                    var value = '<p><img src=' + dataImage + ' class="ih_image left" ></p>';
                    if (oEditor.mode == 'wysiwyg') {
                        oEditor.insertHtml(value);
                        $.modal.close();
                    }
                    else
                        alert('Hiện tại trình duyệt không hỗ trợ chức năng này');

                });
                $.modal.close();
            }
        });
        $('#FilesUploadUploader').css({ "position": "relative", "top": "10px", "left": "50px" });
    });
</script>

<div>
        <div style="padding-top:5px">
           <%-- <h3 style="margin-left:20px;padding-top:5px;border-bottom: 1px solid #CCCCCC;width:90%">Đính kèm ảnh</h3> --%>
             <div id="groupuppic" style="display:none">
             <input id="cmd_uploadfinal" type="button" style="color:Black;width:110px;margin-left:20px;padding-top:5px" value="Hoàn Thành" />
             <input id="cmd_cancle" type="button" style="color:Black;width:110px;margin-left:20px;padding-top:5px"  value="Hủy" /> 	            
             </div>
              <div id="div_copyLink"  style="width:100%;color:Black;font-size:16px; float:left;text-align:left;margin-top:2px;padding-left:10px;padding-right:10px">                                              
                  <ul style="list-style-type:circle;margin-left:50px">
                        Upload, chụp ảnh hoặc copy đường dẫn ảnh từ một hệ thống khác
                  </ul>
            </div>
             
             <div id="div_flashupload_content" style="margin-left:25%" >    
                <div id="FilesUpload" style="position:relative; left:190px; top:-30px">
                        
                           </div>
             
                <div style="width:100%;margin-top:20px;float:left;font-size:16px;color:Black">Link : <input id="input_link" style="width:215px;height:30px" />  <input type="button" value="Chọn Link" style="height:35px;background-color:White;color:Black;border:1px soild gray" onclick="InsertLink();" /></div>
            </div> 
           
            <div id="div_obj"  style="width:100%;text-align:center;margin-top:2px;">
            
                    <img id="img_loading" src="<%=Utility.modHost %>/Images/Loading.gif" alt="" style="margin-top:15%;display:none;width:32px;height:32px;margin-right:250px"   />                                                        
            </div>
            
         
                                                          
        </div>            
</div>
<script type="text/javascript">
    function InsertLink() {
        var link = $('#input_link').val();
        var oEditor = CKEDITOR.instances.txtDescription;
        var value = '<p><img src="' + link + '"  class="ih_image left" ></p>';
        if (oEditor.mode == 'wysiwyg') {
            oEditor.insertHtml(value);
            $.modal.close();
        }
        else
            alert('Hiện tại trình duyệt không hỗ trợ chức năng này');
    }
</script>

